<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>Каталог сайтов</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>

    <!-- Le styles -->
    <link href="css/bootstrap.css" rel="stylesheet"/>
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
    </style>
    <link href="css/bootstrap-responsive.css" rel="stylesheet"/>

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico"/>
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png"/>
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png"/>
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png"/>
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png"/>
  </head>

  <body>

    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="index.php">Каталог сайтов</a>
          <div class="nav-collapse collapse">
            <p class="navbar-text pull-right">
              Вы вошли как <a href="#" class="navbar-link">Username</a>
            </p>
            <ul class="nav">
              <li class="active"><a href="index.php">Главная</a></li>
              <li><a href="#about">О нас</a></li>
              <li><a href="#contact">Контакты</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>

    <div class="container-fluid">
      <div class="row-fluid">
        <div class="span3">
          <div class="well sidebar-nav">
            <ul class="nav nav-list">
              <li class="nav-header">Разделы каталога:</li>
              <li><a href="index.php">Все категории</a></li>
              <?php foreach($menu as $category):?>
              <li><a href="index.php?cat=<?=$category['id_category']?>"><?=$category['name']?></a></li>              
              <?php endforeach?>                            
            </ul>
          </div><!--/.well -->
        </div><!--/span-->
        <div class="span9">
          <div class="hero-unit">
          <?php if(empty($data)):?>            
            <div class="alert alert-info">
                    <p>Пардоньте, в категории пока нету сайтов. Попробуйте зайти позже.</p>
            </div>
          <?php elseif(!$category['id_category']):?>
            <div class="alert alert-block">
                    <h4>Пардон!</h4>
                    Такая категория отсутствует...<br/><br/>
                    попробуйте начать с <a href="index.php">главной страницы</a>
                </div>
          <?php elseif($data[0]['name'] == null):?>
            <h1>Все категории</h1>
            </div>
          <div class="row-fluid">
          <?php foreach($data as $site):?>
            <div class="span4">
              <h2><?=$site['site_url']?></h2>
              <p><img src="img/<?=$site['screenshot']?>.jpg"/></p>
              <p><?=$site['description']?></p>
              <a class="btn" href="http://<?=$site['site_url']?>">Перейти на сайт &raquo;</a>
              <a class="btn" href="index.php?id=<?=$site['id_site']?>">Редактировать &raquo;</a>
            </div><!--/span-->
          <?php endforeach?>
          
          <?php else:?>
            <h1><?=$data[0]['name']?> (<?=$num_of_sites?>)</h1>            
          </div>
          <div class="row-fluid">
          <?php foreach($data as $site):?>
            <div class="span4">
              <h2><?=$site['site_url']?></h2>
              <p><img src="img/<?=$site['screenshot']?>.jpg"/></p>
              <p><?=$site['description']?></p>
              <a class="btn" href="http://<?=$site['site_url']?>">Перейти на сайт &raquo;</a>
              <a class="btn" href="index.php?id=<?=$site['id_site']?>">Редактировать &raquo;</a>
            </div><!--/span-->
          <?php endforeach?>
          <?php endif?>            
          </div><!--/row-->          
        </div><!--/span-->
      </div><!--/row-->

      <hr/>

      <footer>
        <p>&copy; Company 2012</p>
      </footer>

    </div><!--/.fluid-container-->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/bootstrap.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="../assets/js/bootstrap-alert.js"></script>
    <script src="../assets/js/bootstrap-modal.js"></script>
    <script src="../assets/js/bootstrap-dropdown.js"></script>
    <script src="../assets/js/bootstrap-scrollspy.js"></script>
    <script src="../assets/js/bootstrap-tab.js"></script>
    <script src="../assets/js/bootstrap-tooltip.js"></script>
    <script src="../assets/js/bootstrap-popover.js"></script>
    <script src="../assets/js/bootstrap-button.js"></script>
    <script src="../assets/js/bootstrap-collapse.js"></script>
    <script src="../assets/js/bootstrap-carousel.js"></script>
    <script src="../assets/js/bootstrap-typeahead.js"></script>

  </body>
</html>
